import request from '@/utils/request'

/**
 * 获取轮播图列表
 */
export function getBannerList(params) {
  return request({
    url: '/api/banners',
    method: 'get',
    params
  })
}

/**
 * 获取轮播图详情
 */
export function getBannerDetail(id) {
  return request({
    url: `/api/banners/${id}`,
    method: 'get'
  })
}

/**
 * 创建轮播图
 */
export function createBanner(data) {
  return request({
    url: '/api/banners',
    method: 'post',
    data
  })
}

/**
 * 更新轮播图
 */
export function updateBanner(id, data) {
  return request({
    url: `/api/banners/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除轮播图
 */
export function deleteBanner(id) {
  return request({
    url: `/api/banners/${id}`,
    method: 'delete'
  })
}

/**
 * 批量删除轮播图
 */
export function batchDeleteBanners(ids) {
  return request({
    url: '/api/banners/batch',
    method: 'delete',
    data: { ids }
  })
}

/**
 * 更新轮播图状态
 */
export function updateBannerStatus(id, status) {
  return request({
    url: `/api/banners/${id}/status`,
    method: 'put',
    data: { status }
  })
}

/**
 * 更新轮播图排序
 */
export function updateBannerSort(id, sortOrder) {
  return request({
    url: `/api/banners/${id}/sort`,
    method: 'put',
    data: { sortOrder }
  })
}

/**
 * 获取轮播图统计信息
 */
export function getBannerStats() {
  return request({
    url: '/api/banners/stats',
    method: 'get'
  })
}


